<div class="full_w">
    <div class="h_title"><?php echo Yii::t('AdmincpModule.admincp', 'Users'); ?></div>
    <h2>Users</h2>
    <p></p>
    
    <form method="get" id="form" enctype="multipart/form-data">
    <fieldset>
		<legend>Filter</legend>
        <div class="filter-row">
        	<label>Email: </label>
            <input type="text" name="keyword" value="<?php echo trim($args['keyword'], '%'); ?>">
        </div>
        <div class="filter-row">
        	<label>Role: </label>
            <select name="role">
                <option value="">All</option>
                <?php foreach($arrRoles as $R): ?>
                <option value="<?php echo $R['role_id']; ?>" <?php if($R['role_id'] == $args['role_id']): ?>selected<?php endif; ?>>
					<?php echo $R['role_name']; ?>
                </option>
                <?php endforeach; ?>
            </select>
        </div>
        <div class="filter-row">
            <label>Created from</label>
            <input tabindex="5" type="text" id="dfrom" name="dfrom" class="datepicker" value="<?php echo $args['created_from']; ?>" />
            <span style="float:left; width:22px; text-align:center; margin-top:6px;">To</span> 
            <input tabindex="6" type="text" id="dto" name="dto" class="datepicker" value="<?php echo $args['created_to']; ?>" />
        </div>        
        <div style="clear:both; text-align:center">
            <input type="submit" value="Search" /> 
            <input type="reset" name="Clear">
        </div>
    </fieldset>			
    </form>
    <script type="text/javascript">
	$(function() {
		$( ".datepicker" ).datepicker({
			maxDate: "0"
		});
	});
	</script>
    
    <div class="entry">
        <div class="sep"></div>
    </div>
    <table>
        <thead>
            <tr>
            	<th scope="col" class="chb"><input type="checkbox" onclick="selectAll(this);"></th>
                <th scope="col" width="15%"><?php  echo Yii::t('AdmincpModule.admincp', 'Username');?></th>
                <th scope="col" width="25%"><?php  echo Yii::t('AdmincpModule.admincp', 'Name');?>/<?php  echo Yii::t('AdmincpModule.admincp', 'Email');?></th>
                <th scope="col" width="10%"><?php  echo Yii::t('AdmincpModule.admincp', 'Role');?></th>
                <th scope="col" width="10%"><?php  echo Yii::t('AdmincpModule.admincp', 'Registration Date');?></th>
                <th scope="col"><?php  echo Yii::t('AdmincpModule.admincp', 'Description');?></th>
                <th scope="col" width="5%"><?php  echo Yii::t('AdmincpModule.admincp', 'Status');?></th>
            </tr>
        </thead>
            
        <tbody>
        
        <?php if(!empty($arrUsers)):?>
			<?php foreach($arrUsers as $i=>$R):?>
            <tr>
                <td class="align-center"><input type="checkbox"></td>
                <td>
					<strong><a href="javascript:void(0);" style="text-decoration:none;"><?php echo $R['user_username']; ?></a></strong>
                	<p style="margin:0; padding: 2px 0 0;">
                        <a href="<?php echo LINK_ADMINCP_USERS.'/permissions/?id='.$R['user_id']; ?>"  title="Set permissions for this user">Permissions</a> | 
                        <a href="<?php echo LINK_ADMINCP_USERS.'/form/?id='.$R['user_id']; ?>"  title="Edit">Edit</a> | 
                        <a href="<?php echo LINK_ADMINCP_USERS.'/delete/?id='.$R['user_id']; ?>" title="Delete">Delete</a> 
                    </p>
                </td>
                <td><?php echo $R['user_fullname']; ?><br><?php echo $R['user_email']; ?></td>
                <td><?php echo $R['role_id']; ?></td>
                <td class="align-center"><?php echo $R['user_created_date']; ?></td>
                <td><?php echo $R['user_description']; ?></td>
                <td><?php if($R['user_status'] == 1) echo 'Active'; else echo 'Inactive'; ?></td>
            </tr>
            <?php endforeach; ?>
		<?php else: ?>
            <tr>
                <td colspan="7">No data found!</td>
            </tr>
        <?php endif; ?>
        </tbody>
    </table>
    <div class="entry">
        <?php $this->widget('Pagination', array(
			'pages' => $objPages,
		)) ?>
        <div class="sep"></div>		
        <a class="button add" href="<?php echo LINK_ADMINCP_USERS.'/form'; ?>"><?php echo Yii::t('AdmincpModule.admincp', 'Add User'); ?></a> <a class="button" href="">Categories</a> 
    </div>
</div>